﻿@model BcdVolumeDirectoryViewModel
@{
    Layout = null;
    ViewBag.Title = "未归档文件列表";
    string type = ViewBag.Type;
}
<script>
    function volumeRefresh(json) {
        DWZ.ajaxDone(json);
        if (json.statusCode == DWZ.statusCode.ok) {
            refre_jgzl_cllx_index(json);
            $("form[name='pagerForm_volume']", navTab.getCurrentPanel()).submit();
        }
    }
    $.jTableTool.clickRowAction(function ($row) {
        if ($row) {
            var sole = $row.data("sole");
            if (sole != "VolumedirectoryList")
                return;
            else {
                var state = $row.data("state");
                //0=未审核，1=已审核
                if (state != 0) {
                    $("#CompletionMaterials_VolumeList_Edit@(type)").hide();
                    $("#CompletionMaterials_VolumeList_Del@(type)").hide();
                    $("#CompletionMaterials_VolumeList_Check@(type)").hide();
                } else {
                    $("#CompletionMaterials_VolumeList_Edit@(type)").show();
                    $("#CompletionMaterials_VolumeList_Del@(type)").show();
                    $("#CompletionMaterials_VolumeList_Check@(type)").show();
                }
            }

        }
    });
</script>
@using (Html.BeginForm("SplitPage", "VolumeList", null, FormMethod.Post, new { id = "pagerForm", name = "pagerForm_volume", onsubmit = "return divSearch(this, 'jgzl_wj_list_" + type + "');" }))
{
    <input type="hidden" name="pageNum" value="1" />
    <input type="hidden" name="numPerPage" value="@(ViewBag.numPerPage)" />
    <input type="hidden" name="Type" value="@(ViewBag.Type)" />
    <input type="hidden" name="Pft_ID" value="@(ViewBag.Pft_ID)" />
    
    <ul class="searchBar">
        <li><span>文件编号：</span>
            <input type="text" name="iput_code" value="@(ViewBag.iput_code)" />
        </li>
        <li><span>文件材料题名：</span>
            <input type="text" name="iput_name" value="@(ViewBag.iput_name)" />
        </li>
        <li>
            <button type="submit" class="btn btn-success btn-xs">
                搜索</button>
        </li>
    </ul>
   
}
<div class="panelBar" style="border-top: none;">
    <ul class="toolBar">
        <li>
            @Html.PermissionButton("CompletionMaterials.VolumeList.Add" + type, "CompletionMaterials_VolumeList_Add" + type,
                            Url.Action("Add", "VolumeList", new { Pft_ID = ViewBag.Pft_ID }), "添加",
                            new Dictionary<string, object> { 
                             { "class", "add" }, { "mask", "true" }, { "target", "dialog" }, { "width", "450" }, { "height", "480" } 
                            })
        </li>
        <li>
            @Html.PermissionButton("CompletionMaterials.VolumeList.Del" + type, "CompletionMaterials_VolumeList_Del" + type,
                            Url.Action("Del", "VolumeList", new { id = "{ids}" }), "删除",
                            new Dictionary<string, object>{
                             {"class","delete"},{"title","您确定要删除吗?"} ,{"target","ajaxTodo"},{"callback","volumeRefresh"}
                            })
        </li>
        <li>
            @Html.PermissionButton("CompletionMaterials.VolumeList.Edit" + type, "CompletionMaterials_VolumeList_Edit" + type,
                            Url.Action("Edit", "VolumeList", new { id = "{ids}" }), "修改",
                            new Dictionary<string, object>{
                             {"class","edit"} ,{"mask","true"},{"target","dialog"},{"width","450"},{"height","480"},{"warn","请选择一条信息!"}
                            })
        </li>
        <li>
            @Html.PermissionButton("CompletionMaterials.VolumeList.Detail" + type, "CompletionMaterials_VolumeList_Detail" + type,
                            Url.Action("Detail", "VolumeList", new { id = "{ids}" }), "查看",
                            new Dictionary<string, object>{
                             {"class","detail"},{"mask","true"},{"target","dialog"},{"width","550"},{"height","350"},{"warn","请选择一条信息!"}
                            })
        </li>
        <li class="line">line</li>
        <li>
            @Html.PermissionButton("CompletionMaterials.VolumeList.Check" + type, "CompletionMaterials_VolumeList_Check" + type,
                            Url.Action("Check", "VolumeList", new { id = "{ids}" }), "审核",
                            new Dictionary<string, object>{
                             {"class","check"},{"title","您确定要审核通过吗?"} ,{"target","ajaxTodo"},{"callback","volumeRefresh"}
                            })
        </li>
        <li>
            @Html.PermissionButton("CompletionMaterials.VolumeList.FileCreat" + type, "CompletionMaterials_VolumeList_FileCreat" + type,
                            Url.Action("FileCreat", "VolumeList", new { type = type, pftId = ViewBag.Pft_ID }), "组卷",
                            new Dictionary<string, object> { 
                             { "class", "jlDrafts" }, { "mask", "true" }, { "target", "dialog" }, { "width", "800" }, { "height", "550" } 
                            })
        </li>
    </ul>
</div>
<table class="table" width="100%" layoutH="150" nowraptd="false" rel="jgzl_wj_list_@(type)">
    <thead>
        <tr align="center">
            <th width="35">序号</th>
            <th width="120">文件编号</th>
            <th>文件材料题名</th>
            <th width="150">责任者</th>
            <th width="120">日期</th>
            <th width="35">页数</th>
            <th width="100">附件</th>
            <th width="80">状态</th>
        </tr>
    </thead>
    <tbody>
        @{ int num = (ViewBag.pageNum - 1) * ViewBag.numPerPage;}
        @foreach (var item in Model.TheBcdVolumedirectoryList)
        {
            num += 1;
            string state = "";
            string title = "";
            switch (item.Vd_State)
            {
                case 0:
                    state = "未审核";
                    break;
                case 1:
                    state = "审核通过";
                    break;
                case 2:
                    state = "已归档";
                    title = "档案号：" + item.Fl_Code + "-" + item.Fl_Numb.ToString("D3");
                    break;
                default:
                    break;
            }
            <tr target="ids" rel="@item.Vd_ID" align="center" data-state="@item.Vd_State" data-sole="VolumedirectoryList" title="@(title)">
                <td>@(num)</td>
                <td>@(item.Vd_Code)</td>
                <td><a style="color:#000" href="@Url.Action("Detail", "VolumeList", new { id = item.Vd_ID })" mask="true" target="dialog" width="550" height="350" title="查看文件">@(item.Vd_Name)</a></td>
                <td>@(item.Vd_Duty)</td>
                <td>@(item.Vd_Date == null ? "" : Convert.ToDateTime(item.Vd_Date).ToString("yyyy-MM-dd"))</td>
                <td>@(item.Vd_PageNumb)</td>
                <td>
                    <button id="dialogBtn" type="button" onclick="openAttachFileDialog('@item.FilePath')">附件(@(item.FileCount))</button></td>
                <td>@(state)</td>
            </tr>
        }
    </tbody>
</table>
<div class="panelBar" style="border-bottom: none;">
    <div class="pages" style="float: right">
        <span>显示</span>
        <select class="comsplitpage" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value},'jgzl_wj_list_@(type)')">
            <option value="10" @(ViewBag.numPerPage == 10 ? "selected='selected'" : "")>10</option>
            <option value="20" @(ViewBag.numPerPage == 20 ? "selected='selected'" : "")>20</option>
            <option value="50" @(ViewBag.numPerPage == 50 ? "selected='selected'" : "")>50</option>
        </select>
        <span>条，共@(ViewBag.pagenumshown)页,@(ViewBag.totalcount)条</span>
    </div>
    <div class="pagination" style="margin:0px;float:left; margin-left:35%" rel="jgzl_wj_list_@(type)" totalcount="@(ViewBag.totalcount)" numperpage="@(ViewBag.numPerPage)" pagenumshown="10" currentpage="@(ViewBag.pageNum)">
    </div>
</div>
<div id="dialog_file">
    <iframe id="myIframe" src="" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" style="height: 650px; width: 1150px;">
    </iframe>
</div>
<script>
    var attachFilePath_1;
    $("#dialog_file").dialog({
        title: "附件管理",
        autoOpen: false,
        modal: true,
        width: 1200,
        height: 710,
        open: function (ev, ui) {
            $('#myIframe').attr('src', attachFilePath_1);
        }
    });

    function openAttachFileDialog(filePath) {
        attachFilePath_1 = 'CompletionMaterials/FileManager/Index?filePath=' + encodeURI(filePath);
        $('#dialog_file').dialog('open');
    }
</script>
